﻿/**
 * @author sminutoli
 * version 1.0
 * hay que revisar como maneja el undefined cuando me hacen un setValue
 * 
 */
import com.dinmax.flash.draw.cabeza.*
class FieldCabeza
extends ControlCabeza {
	
	private var txt_value:TextField;
	private var txt_label:TextField;
	
	public function FieldCabeza() {
		
		var root:FieldCabeza = this;
		txt_value.onChanged= function (){
			root.setValue(this.text);
		};
	};
	
	public function setLabel(label:String):Void {
		txt_label.text = label;
		return;
	};
	
	public function setValue(value:String):Void {
		super.setValue(value);
		if(value != undefined && value != null && value != "undefined"){
			txt_value.text = value;
		} else {
			txt_value.text = "";
		};
		this.changeEvent(undefined);
		return;
	};
	
	public function getValue():String {
		var s:String = String(super.getValue());
		//trace("FieldCabeza.as getValue()= "+s);
		return s;
	};
	
	public function getField():TextField {
		//trace("FieldCabeza.as getFieldValue()= "+ txt_value);
		return txt_value;
	};
		
};